using System;
using System.Data;
using System.Web;
namespace HKB.Web
{
	public class HowaveCache
	{
		public void CreateCache(string CacheName, double CacheSaveTime, object CacheSaveObj)
		{
			if (CacheSaveTime <= 0.0)
			{
				CacheSaveTime = 1.0;
			}
			HttpContext.Current.Cache.Insert(CacheName, CacheSaveObj, null, DateTime.Now.AddMinutes(CacheSaveTime), TimeSpan.Zero);
		}
		public void RemoveCahce(string CahceName)
		{
			HttpContext.Current.Cache.Remove(CahceName);
		}
		public DataTable GetCacheDataTable(string CacheName)
		{
			DataTable result;
			if (HttpContext.Current.Cache[CacheName] != null)
			{
				result = (DataTable)HttpContext.Current.Cache[CacheName];
			}
			else
			{
				result = null;
			}
			return result;
		}
	}
}
